home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-04-21 | 1.5 KB | 61 lines | [TEXT/MPS ] |
- // The C++ Booch Components (Version 2.1)
- // (C) Copyright 1990-1993 Grady Booch. All Rights Reserved.
- //
- // BCBTree.h
- //
- // This file contains the declaration of the binary tree.
-
- #ifndef BCBTREE_H
- #define BCBTREE_H 1
-
- #include "BCNodes.h"
-
- enum BC_Child {BC_kLeft, BC_kRight};
-
- // Binary tree
-
- template<class Item, class StorageManager>
- class BC_TBinaryTree {
- public:
-
- BC_TBinaryTree();
- BC_TBinaryTree(const BC_TBinaryTree<Item, StorageManager>&);
- ~BC_TBinaryTree();
-
- BC_TBinaryTree<Item, StorageManager>&
- operator=(const BC_TBinaryTree<Item, StorageManager>&);
- BC_Boolean operator==(const BC_TBinaryTree<Item, StorageManager>&) const;
- BC_Boolean operator!=(const BC_TBinaryTree<Item, StorageManager>&) const;
-
- void Clear();
- void Insert(const Item&, BC_Child child);
- void Append(const Item&, BC_Child child, BC_Child after);
- void Remove(BC_Child child);
- void Share(BC_TBinaryTree<Item, StorageManager>&, BC_Child child);
- void SwapChild(BC_TBinaryTree<Item, StorageManager>&, BC_Child child);
- void Child(BC_Child child);
- void LeftChild();
- void RightChild();
- void Parent();
- void SetItem(const Item&);
-
- BC_Boolean HasChildren() const;
- BC_Boolean IsNull() const;
- BC_Boolean IsShared() const;
- BC_Boolean IsRoot() const;
- const Item& ItemAt() const;
- Item& ItemAt();
-
- static void* operator new(size_t);
- static void operator delete(void*, size_t);
-
- protected:
-
- BC_TBinaryNode<Item, StorageManager>* fRep;
-
- void Purge(BC_TBinaryNode<Item, StorageManager>*&);
-
- };
-
- #endif
-